package com.fcbox;

/**
 * Application
 * Created by 000498 on 2016/11/10.
 */

import com.fcbox.mapper.edms.EdmUserMapper;
import com.fcbox.mapper.edms.EdmUserXmlMapper;
import com.fcbox.mapper.uic.UicUserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.concurrent.TimeUnit;

/**
 * springboot启动类
 * Created by 01108334 on 2016/8/19.
 */
@SpringBootApplication
//如果需要配置xml的话（比如dubbo）打开下面的配置
//@ImportResource("classpath:application-context.xml")
public class Application  implements CommandLineRunner {

	Logger log = LoggerFactory.getLogger(Application.class);

	@Autowired
	private EdmUserMapper edmUserMapper;

	@Autowired
	private EdmUserXmlMapper edmUserXmlMapper;

	@Autowired
	private UicUserMapper uicUserMapper;

	@Autowired
	@Qualifier("redisTemplate")
	private RedisTemplate edmsRedis;

	@Autowired
	@Qualifier("uicRedisTemplate")
	private RedisTemplate uicRedis;

	public void run(String... strings) throws Exception {
		String queryEdmId = edmUserMapper.queryEdmId("15680908680");
		log.info("edmUserMapper.queryEdmId-> {}", queryEdmId);
		String queryEdmUserId = edmUserXmlMapper.queryEdmUserId("15680908680");
		log.info("edmUserXmlMapper.queryEdmUserId-> {}", queryEdmUserId);
		Long queryId = uicUserMapper.queryId("15680908680");
		log.info("uicUserMapper.queryId-> {}", queryId);

		edmsRedis.opsForValue().set("aa", "edmsRedis", 1, TimeUnit.MINUTES);
		Object aa = edmsRedis.opsForValue().get("aa");
		log.info("edmsRedis:{}", aa);
		uicRedis.opsForValue().set("aa", "uicRedis", 1, TimeUnit.MINUTES);
		Object aa1 = uicRedis.opsForValue().get("aa");
		log.info("uicRedis:{}", aa1);
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args).close();
	}
}
